<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>

    <base href="<%=basePath%>"/>
    <title>${title }</title>
    <script>
        function goChoice(a){
            //获取变量 价格，日期，影院，影厅，场次
            /*var film="${requestScope.goods}"
            console.log(film)*/

            var ownday = $("a[ty$='day'][class$='active']").attr("id")
            var hallid = $("a[ty$='hall'][class$='active']").attr("id")
            var hallname=$("a[ty$='hall'][class$='active']").text()
            var cinemaid = $("a[ty$='cinema'][class$='active']").attr("id")
            var cinemaname = $("a[ty$='cinema'][class$='active']").text()

            if(ownday==null) {
                alert("请选择哪一天！")
                return
            }
            if(hallid==null) {
                alert("请选择影厅！")
                return
            }
            if(cinemaid==null) {
                alert("请选择影院！")
                return
            }
            //场次
            var tr=$(a).closest('tr'), td = tr.find('td');
            var start=td.eq(2).html()
            var end=td.eq(3).html()
            var roundid=td.eq(4).html()
            /*alert(tr[0].rowIndex)
            alert(td.eq(2).html())*/
            //定义场次对象
            var round={ownday:ownday,hallid:hallid,hallname:hallname,cinemaid:cinemaid,cinemaname:cinemaname,roundid:roundid}
            console.log("roundid"+roundid)

            //跳转到选座页面
            window.location.href="round/getChoice.action?roundid="+roundid
            //ajax调用
            /*$.ajax(
                {
                    type: 'post',
                    url: 'round/getChoice.action',
                    data: {roundid:roundid}/!*,
                    dataType: 'json',
                    success: function (data) {
                        if(data) {
                            window.location.href = "users/choice.jsp"
                        }
                    },
                    error: function () {
                        alert('跳转失败！')
                    }*!/
                }
            )*/
        }
    </script>
</head>

<body>
<table style="width: 100%" class="table">
    <tr class="tr2">
        <td><strong>影厅编号</strong></td>
        <td><strong>影厅名称</strong></td>
        <td><strong>开始时间</strong></td>
        <td><strong>散场时间</strong></td>
        <td hidden="true">场次ID</td>
        <td><strong>价格</strong></td>
    </tr>
    <c:forEach items="${rounds}" var="r">
        <tr>
            <td>${r.hall.hallid}</td>
            <td>${r.hall.hallname}</td>
            <td>${r.start}</td>
            <td>${r.end}</td>
            <td hidden="true">${r.roundid}</td>
            <td>${r.film.price}元</td>
            <td>
                <a class="f_l bnt_blue" href="javascript:void(0)" onclick="goChoice(this)">选座</a>
            </td>
        </tr>
    </c:forEach>
</table>


</body>
</html>
